package com.example.demo3.c6;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/second")
public class SecondServiet extends HttpServlet {
    public SecondServiet() {
        super();
    }
    @Override
    public void destroy() {
        super.destroy();
    }
    @Override
    public void init() throws ServletException {
        super.init();
    }
    protected  void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
        out.println("<HTML>");
        out.println("<HEAD><title>动态生成的HTML文档</title></HEAD>");
        out.println("<body>");
        out.println("<table border='0' align='center'>");
        out.println("<tr><td bgcolor='skyblue' colspan='2'>动态文档生成</td></tr>");
        out.println("</table>");
        out.println("</HEAD>");
        out.println("</body>");
        out.println("</html>");
        out.flush();
        out.close();
    }
    protected  void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
